package com.lcm.learn.lcmcode.annotation;

import java.lang.annotation.*;
import java.util.Arrays;

/**
 * @description:
 * @author: lcm
 * @create: 2020-01-17 15:49
 **/
@Test
public class AnnotationTest {

    public static void main(String[] args){
        AnnotationTest test=new AnnotationTest();
        Annotation[] annotations = test.getClass().getAnnotations();
        System.out.println(Arrays.toString(annotations));
        System.out.println(((Test)annotations[0]).key());
    }

}

@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@interface Test{
    String key() default "key";
    String value() default "value";
}